const debounce = (fn: any, delay: any, ...value: any) => {
  let timer: any = null;
  return () => {
    const context = this;
    const args = value;
    clearTimeout(timer);
    timer = setTimeout(function () {
      fn.apply(context, args);
    }, delay);
  };
};

function resizeObserver() {
  const _ResizeObserver = window.ResizeObserver;
  window.ResizeObserver = class ResizeObserver extends _ResizeObserver {
    constructor(callback: any) {
      callback = debounce(callback, 16);
      super(callback);
    }
  };
}
export default resizeObserver;
